Skip to content

Update weborker code to work with te CDN#1285

Merged
dpvc merged 12 commits intodevelopfrom
update/workers
Jun 24, 2025
Merged

Update weborker code to work with te CDN#1285
dpvc merged 12 commits intodevelopfrom
update/workers

Conversation

@dpvc
Copy link
Copy Markdown
Member

@dpvc dpvc commented Jun 22, 2025

This PR resolves the problems we are having with using the worker code from the CDN. It rurns out that jsdelivr won't serve the HTML file for the worker pool (it wraps it in al in a <pre>), so it doesn't run the code that starts the worker. That ends up being a pretty big problem.

I will write more about it tomorrow, but for now, the big change is to remove the worker pool entirely and have the WebWorker.ts file create the worker itself and communicate directly with it. The trick is to make a dynamically created blob object that imports the needed CDN file after a bit of setup. Because the CDN has access-control headers that allow that, it works. It also works if you host it on your own server, as there is no cross-origin issue.

This is a cleaner solution than our original, which is nice. I was able to remove a lot of hacky code from the liteDOM, for example.

There is still an issue with the clearspeak menu, but I wanted to give you a chance to try it out and see what you think.

You will need to rebuild everything, including running the lab:sre script.

@dpvc dpvc requested a review from zorkow June 22, 2025 23:15
@dpvc dpvc added this to the v4.0 milestone Jun 22, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 53.33333% with 56 lines in your changes missing coverage. Please review.

Project coverage is 86.71%. Comparing base (62226e2) to head (8448689).
Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
ts/adaptors/HTMLAdaptor.ts 34.88% 28 Missing ⚠️
ts/adaptors/liteAdaptor.ts 40.42% 28 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1285      +/-   ##
===========================================
+ Coverage    86.69%   86.71%   +0.02%     
===========================================
  Files          337      337              
  Lines        84107    83979     -128     
  Branches      3126     4750    +1624     
===========================================
- Hits         72919    72826      -93     
+ Misses       11188    11130      -58     
- Partials         0       23      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment.
Otherwise this looks great. I particularly like that the LiteAdaptor, in particular LiteElement, is no longer dependent on mathjax at all.

Comment thread ts/adaptors/HTMLAdaptor.ts Outdated
@dpvc
Copy link
Copy Markdown
Member Author

dpvc commented Jun 24, 2025

I particularly like that the LiteAdaptor, in particular LiteElement, is no longer dependent on mathjax at all.

Yes, I am glad to be able to remove that code as well. It was never ideal, but worked for what we needed. This is much cleaner, so for that reason, I'm glad we ran into the problem and were able to fix it in a better way.

@dpvc dpvc merged commit 856bbe7 into develop Jun 24, 2025
2 of 3 checks passed
@dpvc dpvc deleted the update/workers branch June 24, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants